package com.database.common.result;

import com.database.common.BaseResultCodeEnum;

/**
 * 单个对象的返回结果
 * 
 * @author peitong.xue
 * @version 1.0
 * @since 1.0 2015年11月21日 下午11:46:51
 */
public class SingleResult<T> extends CommonResult {

    /** serialVersionUID */
    private static final long serialVersionUID = 807003977989498433L;

    /** 结果对象 */
    private T                 data;

    /**
     * 默认构造函数
     */
    public SingleResult() {
    }

    /**
     * 构造函数
     * 
     * @param resultCodeEnum 结果编码
     */
    public SingleResult(BaseResultCodeEnum baseResultCodeEnum, T data) {
        setSuccess(baseResultCodeEnum == BaseResultCodeEnum.ERR_CODE_200);
        setResultCode(baseResultCodeEnum.getCode());
        setResultMsg(baseResultCodeEnum.getMsg());
        setData(data);
    }

    /**
     * Getter method for property <tt>data</tt>.
     * 
     * @return property value of data
     */
    public T getData() {
        return data;
    }

    /**
     * Setter method for property <tt>data</tt>.
     * 
     * @param data value to be assigned to property data
     */
    public void setData(T data) {
        this.data = data;
    }

}
